<?php
class Basemodel extends CI_Model {
 
	

        
    function get($mon){
		
		if($mon == 0){
			$date_time_array = getdate( time() );
			$mon = $date_time_array['mon'];
		};
		
		$query = $this->db->query("SELECT 
		id, descr, name, date, itog, type, form FROM ssrt5_turnirs 
		WHERE date 
		BETWEEN '2013-$mon-01' AND '2013-$mon-31' ORDER BY date ASC");
		
		return $query->result();
	}
	
	function gettur($id){
		$this->db->select('idtur');
		$this->db->where('iduser', $id); 
		$query = $this->db->get('ssrt5_turniruser');
		
		return $query->result();
	}
	
	function getdates(){
		$query = $this->db->query("
		SELECT 
				DISTINCT MONTH(ssrt5_turnirs.date) AS mon
		FROM 
					ssrt5_turnirs
		ORDER BY 
					ssrt5_turnirs.date
	    DESC");
	    
	    return $query->result();
	
	}
}
?>
